package nc.ui.tools.MyUI;

import nc.ui.pub.ButtonObject;
import nc.ui.pub.ClientEnvironment;
import nc.ui.pub.bill.BillItem;
import nc.ui.so.so001.panel.SaleBillUI;
import nc.ui.so.so001.panel.card.SOBillCardPanel;
import nc.ui.so.so001.panel.list.SOBillListPanel;
import nc.ui.tools.FunSwitch.FunSwitch;
import nc.vo.bd.CorpVO;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.lang.UFDate;

public class FakeUI_SaleBillUI implements IFakeUI {
	private SaleBillUI saleBillUI = null;

	public FakeUI_SaleBillUI(SaleBillUI saleBillUI) {
		this.saleBillUI = saleBillUI;
	}
	protected SOBillCardPanel getBillCardPanel() {
		return saleBillUI.getBillCardPanel();
	}

	protected SOBillListPanel getBillListPanel() {
		return saleBillUI.getBillListPanel();
	}

	public String getBodyValue(int row, String key) {
		Object obj = getBillCardPanel().getBodyValueAt(row, key);
		if (obj != null) {
			return obj.toString();
		} else {
			return null;
		}

	}

	public BillItem getHeaditem(String key) {

		return getBillCardPanel().getHeadItem(key);
	}

	public void setBodyValueAt(Object aValue, int row, String strKey) {
		getBillCardPanel().setBodyValueAt(aValue, row, strKey);
	}

	public void showErrorMessage(String msg) {
		saleBillUI.showErrorMessage(msg);
	}

	public void showWarningMessage(String msg) {
		saleBillUI.showWarningMessage(msg);
	}

	public int showYesNoMessage(String msg) {

		return saleBillUI.showYesNoMessage(msg);
	}

	public CorpVO _getCorp() {

		return ClientEnvironment.getInstance().getCorporation();
	}

	public UFDate _getDate() {

		return ClientEnvironment.getInstance().getDate();
	}

	public String _getOperator() {

		return ClientEnvironment.getInstance().getUser().getCorpId();
	}

	public double doublevalue(Object obj) {
		if (obj == null || obj.toString().equals("")) {
			return 0;
		} else {
			return Double.parseDouble(obj.toString());
		}
	}

	public AggregatedValueObject getVo() {
		return saleBillUI.getVo();
	}
	public SaleBillUI getSaleBillUI() {
		return saleBillUI;
	}
}
